<?php
/**
 *    Assertion that can display failure information.
 *    Also includes various helper methods.
 */
abstract class Expectation {
    protected $dumper = false;
    protected $compareResult= false;

    /**
     *    Creates a dumper for displaying values and sets
     *    the test message.
     *    @param string $message    Customised message on failure.
     */
    function __construct() {
    }

    /**
     *    Tests the expectation. True if correct.
     *    @param mixed $compare        Comparison value.
     *    @return boolean              True if correct.
     *    @access public
     *    @abstract
     */
    function test($compare) {
    }

    /**
     *    Returns a human readable test message.
     *    @param mixed $compare      Comparison value.
     *    @return string             Description of success
     *                               or failure.
     *    @access public
     *    @abstract
     */
    function testMessage($compare) {
    }

    /**
     *    Accessor for the dumper.
     *    @return QStone_Dumper    Current value dumper.
     *    @access protected
     */
    protected function getDumper() {
        if (! $this->dumper) {
            $this->dumper = QStone_Dumper::getDumper();
        }
        return $this->dumper;
    }
}

?>
